using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class KillSound : MonoBehaviour
{
    private int playInx = 1;

    public AudioClip a1;
    public AudioClip a2;
    public AudioClip a3;
    private static float pai32 = 0.238f;
    private float chazhi = 0.238f;

    private int cnt = 4;

    private float palyBgm = 0;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    private bool isPlay;

    // Update is called once per frame
    void Update()
    {
        chazhi -= Time.deltaTime;
        palyBgm+=Time.deltaTime;
        if (chazhi <= 0)
        {
            chazhi = pai32;
            if (isPlay)
            {
                isPlay = false;
                GetComponent<AudioSource>().Play();
                // GameObject.Find("bgmBase").GetComponent<AudioSource>().volume= 0;
                // palyBgm = 0;
            }
        }
        
        
    }

    public void PlaySound()
    {
        isPlay = true;

        // GetComponent<AudioSource>().time = chazhi;
        // GetComponent<AudioSource>().Play();

        
        //
        // GetComponent<AudioSource>().Play();
    }
}
